<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNavigationTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('navigation', function (Blueprint $table) {
            $table->increments('id')->comment('自增ID');
            $table->unsignedTinyInteger('type')->default('1')->comment('导航类型，1栏目 2自定义链接');
            $table->unsignedInteger('info_category_id')->default('0')->comment('信息栏目分类ID，栏目类型为栏目时必填');
            $table->unsignedInteger('parent_id')->default('0')->comment('上级导航');
            $table->string('name', 50)->default('')->comment('导航名称');
            $table->string('id_name', 100)->default('')->comment('导航标识，英文字母命名且不可重复，前台导航调用数据标识');
            $table->string('href', 100)->default('')->comment('链接地址');
            $table->string('href_target', 20)->default('')->comment('打开方式');
            $table->string('rel', 20)->comment('链接关系XFN，数据来源数据字典');
            $table->string('class_name', 50)->default('')->comment('【备用】样式名称，多个空格隔开');
            $table->unsignedInteger('sort')->default('999')->comment('排序位置');
            $table->tinyInteger('status')->default(1)->comment('发布状态，0未发布，1已发布 ，数据字典');
            $table->unsignedInteger('created_user_id')->default('0')->comment('管理员ID');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
            $table->timestamp('updated_at')->nullable()->comment('更新时间');
            $table->softDeletes()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('navigation');
    }
}
